package com.mccken.designpattern.adapter.adapter2.step2;

import com.mccken.designpattern.adapter.adapter2.step1.SigninService;
import com.mccken.designpattern.adapter.adapter2.support.ResultMsg;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2022-10-26 11:36
 **/
public class SignInForThirdService extends SigninService {

	/**
	 * 1. openId 是全局唯一的，可以把它当成一个加长版的username
	 * 2. 密码默认为 QQ_EMPTY
	 * 3. 注册 （在原有系统中创建一个用户）
	 * 4. 调用原来的登陆方法
	 * 
	 * @param openId
	 * @return
	 */
	public ResultMsg loginForQQ(String openId) {
		return this.loginForRegistry(openId, null);
	}
	
	public ResultMsg loginForWechat(String openId) {
		return this.loginForWechat(openId);
	}
	
	public ResultMsg loginForToken(String token) {
		// 通过token获取用户信息，然后重新登录一次
		return null;
	}
	
	public ResultMsg loginForTelephone(String telephone, String code) {
		return null;
	}

	private ResultMsg loginForRegistry(String username, Object password) {
		super.register(username, null);
		return super.login(username, null);
	}
}
